from django.contrib import admin
from .models import *

class ImgInline(admin.StackedInline):
    model = Img


@admin.register(ImgType)
class ImgTypeAdmin(admin.ModelAdmin):
    # 每页显示数据
    list_per_page = 10
    # 显示列
    list_display = ["id", "type"]
    # 过滤器
    list_filter = ["is_delete"]
    # 搜索框
    search_fields = ["type"]
    inlines = [ImgInline]


@admin.register(Img)
class ImgAdmin(admin.ModelAdmin):
    # 每页显示数据
    list_per_page = 10
    # 显示列
    list_display = ["id", "type", "img"]
    # 过滤器
    list_filter = ["is_delete","type"]


